"use strict";
/**
 * 接口
 * @author zhaojiuyi
 * @date 2022/6/1-9:51
 * @version 1.0.0
 */

import store from '@/store/index';
import {getRequest, postRequest} from './requests/requests';

export default {
  async login(loginData) {
    return await postRequest({
      url: '/user/login',
      params: loginData
    })
  },
  async register(registerData) {
    return await postRequest({
      url: '/user/register',
      params: registerData
    })
  },
  async getVerCode(phoneNumber) {
    return await postRequest({
      url: '/user/verCode',
      params: {
        phoneNumber
      }
    })
  },
  async getFolderContent(folderId) {
    return await postRequest({
      url: '/folder/getContent',
      params: {
        folderId
      }
    })
  },
  async createFolder(folderId,folderName) {
    return await postRequest({
      url: '/folder/createFolder',
      params: {
        folderId,
        folderName
      }
    })
  },
  async deleteFolder(id) {
    return await postRequest({
      url: '/folder/deleteFolder',
      params: {
        folderId:id
      }
    })
  },
  async deleteFile(id) {
    return await postRequest({
      url: '/file/deleteFile',
      params: {
        fileId:id
      }
    })
  },
  async downloadFile(fileId) {
    return await getRequest({
      url: '/file/downLoadFile',
      getHeader: 1,
      responseType: 'blob',//设置响应的数据类型为一个包含二进制数据的 Blob 对象，必须设置
      params: {
        fileId
      }
    })
  },
}

